package cn.stylefeng.guns.modular.system.service.impl;

import cn.stylefeng.guns.modular.system.model.GameConfig;
import cn.stylefeng.guns.modular.system.dao.GameConfigMapper;
import cn.stylefeng.guns.modular.system.service.IGameConfigService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.nineshadow.games.Enum.GameConfigEnum;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liyong
 * @since 2019-11-28
 */
@Service
public class GameConfigServiceImpl extends ServiceImpl<GameConfigMapper, GameConfig> implements IGameConfigService {

    @Override
    public String getConfig(GameConfigEnum gameConfigEnum) {
        GameConfig gameConfig=selectOne(new EntityWrapper<GameConfig>().eq("type",gameConfigEnum.getMsg()));
        if(Objects.isNull(gameConfig)){
            return "";
        }
        return gameConfig.getValue();
    }
}
